#encoding=utf-8
from bs4 import BeautifulSoup

from com.common import html_down


def parse_page( url ):
    data = html_down.getHtml(url)
    soup = BeautifulSoup(data,'html.parser')
    pagemod = soup.find('div',class_='mod_pages')
    nexturl = pagemod.find('a',class_='page_next')['href']
    ##解析该页的电视剧
    lists = soup.find_all('li',class_='list_item')
    for one in lists:
        title_score = one.find('div',class_='figure_title_score')
        name = title_score.a.string
        score_all = title_score.find('div',class_='figure_score').find_all('em')
        score=''
        for score_one in score_all:
            score += score_one.string
        count = one.find('div',class_='figure_count').span.string
        print (name, score, count)

    while nexturl !='javascript:;':
         nexturl = 'https://v.qq.com/x/list/tv'+ nexturl
         parse_page(nexturl)

if __name__ == '__main__':
    parse_page('https://v.qq.com/x/list/tv')